
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 2149. -- 拆迁队 -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>2149: 拆迁队</h2><span class=green>Time Limit: </span>10 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>259 MB<br><span class=green>Submit: </span>38&nbsp;&nbsp;<span class=green>Solved: </span>21<br>[<a href='submitpage.php?id=2149'>Submit</a>][<a href='problemstatus.php?id=2149'>Status</a>][<a href='bbs.php?id=2149'>Discuss</a>]</center><h2>Description</h2><div class=content><p class="NOI1" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="text-decoration: none; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; text-underline: none"><font size="3"><u><font face="Times New Roman">lanxisi带领着他的拆迁队来整治一个街道。这个街道由<i>N</i>个旧房子组成，从左到右编号为1..<i>N</i>。每个旧房子<i>i</i>有一个正整数的美观度<i>A<sub>i</sub></i>。<o:p></o:p></font></u></font></span></p>
<p class="NOI1" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="text-decoration: none; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; text-underline: none"><font size="3"><u><font face="Times New Roman">lanxisi希望整个街道从左到右美观度严格递增，也就是保证<i>A<sub>i</sub></i>&lt;<i>A<sub>j</sub></i>（<i>i</i>&lt;<i>j</i>）。但是旧的街道明显不符合这个要求，于是lanxisi希望拆迁一些旧房子并在原地建立新房子来满足这一要求。但是与很多拆迁队一样，很多钉子户拒绝拆迁。所以lanxisi希望能保留最多的旧房子来满足某些钉子户，当然，保留一个旧房子需要给房子主人<i>B<sub>i</sub></i>的赔偿金。最后，总花费=整治好以后所有房子美观度之和+赔偿金之和。新的美观值也都必须是正整数。<o:p></o:p></font></u></font></span></p>
<p class="NOI1" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="text-decoration: none; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; text-underline: none"><u><font size="3"><font face="Times New Roman">现在，请你求出lanxisi最多能保留多少旧房子和整治这个街道所需要的最少总花费（当然是在保留旧房子最多这个前提下的）。<o:p></o:p></font></font></u></span></p>
<p></p></div><h2>Input</h2><div class=content><p>第一行有1个整数N，表示旧房子个数。第二行有N个整数，第i个数Ai表示旧房子的美观度。第三行有N个整数，第i个数Bi表示保留旧房子的赔偿金。</p></div><h2>Output</h2><div class=content><p>第一行输出2个整数，表示保留的旧房子数量、总花费的大小。【样例输入一】 4 2 1 7 4 1 5 4 3 【样例输入二】 6 1 6 3 4 7 7 1 2 1 1 1 9</p></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>【样例输出一】<br />
2 25<br />
<br />
【样例输出二】<br />
4 29<br />
<br />
【数据范围】<br />
100%的数据中，1<=N<=100000，0<=Ai,Bi<=100000000。<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata></span></div><h2>HINT</h2>
			<div class=content><p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search=By 鲁逸沁'>By 鲁逸沁</a></p></div><center>[<a href='submitpage.php?id=2149'>Submit</a>][<a href='problemstatus.php?id=2149'>Status</a>][<a href='bbs.php?id=2149'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
